//
//  ViewController.m
//  Manage
//
//  Created by 杨康 on 2017/10/27.
//  Copyright © 2017年 杨康. All rights reserved.
//

#import "ViewController.h"
#import "LeftViewController.h"
#import "UIViewController+CWLateralSlide.h"
#import "HCScanQRViewController.h"
#import "UnLockViewController.h"
#import "PaymentViewController.h"
@interface ViewController ()<MAMapViewDelegate>
{
    UIView *_bottomView;
    CLLocationCoordinate2D _coor;
}
@property (nonatomic, strong) MAMapView *mapView;
@property (nonatomic, strong) MAAnnotationView *userLocationAnnotationView;
@property (nonatomic, strong) NSMutableArray *annotations;
@property (nonatomic, strong) UIView *noPackageView;
@end
@implementation ViewController
- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    
//    MAAnnotationView *userLocationView = [self.mapView viewForAnnotation:self.mapView.userLocation];
//    [UIView animateWithDuration:0.1 animations:^{
//
//        double degree = self.mapView.userLocation.heading.trueHeading - self.mapView.rotationDegree;
//        userLocationView.imageView.transform = CGAffineTransformMakeRotation(degree * M_PI / 180.f );
//    }];
    
    
    self.mapView.compassOrigin=CGPointMake(0, 60);
    self.mapView.showsUserLocation = YES;
    
    _coor=CLLocationCoordinate2DMake(40.978234, 116.352792);
    MAPointAnnotation *a1 = [[MAPointAnnotation alloc] init];
    a1.coordinate = _coor;
    a1.title= @"电动车定位";
    
    
    [self.mapView addAnnotation:a1];
    
    
    [self.mapView addAnnotations:self.annotations];
//    [self.mapView showAnnotations:self.annotations animated:YES];
    
    self.mapView.zoomLevel=20;
}
-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    self.mapView.showsUserLocation = NO;
}
#pragma mark - Initialization
- (void)initAnnotations
{
    self.annotations = [NSMutableArray array];
    
    CLLocationCoordinate2D coordinates[10] = {
        {39.992520, 116.336170},
        {39.992520, 116.336170},
        {39.998293, 116.352343},
        {40.004087, 116.348904},
        {40.001442, 116.353915},
        {39.989105, 116.353915},
        {39.989098, 116.360200},
        {39.998439, 116.360201},
        {39.979590, 116.324219},
        {39.978234, 116.352792}};
    
    for (int i = 0; i < 10; ++i)
    {
        MAPointAnnotation *a1 = [[MAPointAnnotation alloc] init];
        a1.coordinate = coordinates[i];
        a1.title= @"电站定位";
        [self.annotations addObject:a1];
    }
}


- (void)viewDidLoad {
    [super viewDidLoad];

    self.navigationItem.title = @"熊猫充电";
    
    [self initAnnotations];
    
    
    UIButton *leftButton=[NetworkPath SetNavLeftBtnWithController:self withTitle:nil andImageName:@"左详情"];
    
    [leftButton addTarget:self action:@selector(leftAction) forControlEvents:UIControlEventTouchUpInside];
    
    
    // 注册手势驱动
    __weak typeof(self)weakSelf = self;
    // 第一个参数为是否开启边缘手势，开启则默认从边缘50距离内有效，第二个block为手势过程中我们希望做的操作
    [self cw_registerShowIntractiveWithEdgeGesture:NO transitionDirectionAutoBlock:^(CWDrawerTransitionDirection direction) {
        //NSLog(@"direction = %ld", direction);
        if (direction == CWDrawerTransitionDirectionLeft) { // 左侧滑出
            [weakSelf leftAction];
        } else if (direction == CWDrawerTransitionDirectionRight) { // 右侧滑出
            [weakSelf rightAction];
        }
    }];
    
    
//    UIButton *rightButton=[NetworkPath SetNavRightBtnWithController:self withTitle:nil andImageName:nil];
//    [rightButton addTarget:self action:@selector(rightAction) forControlEvents:UIControlEventTouchUpInside];
    
    
    
    ///初始化地图
    self.mapView = [[MAMapView alloc] init];
    self.mapView.delegate = self;
    ///把地图添加至view
    [self.view addSubview:self.mapView];
    [self.mapView  mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.mas_equalTo(TOP_HEIGHT);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT-TOP_HEIGHT));
    }];
    
    
    
    
    
    
//    self.mapView.showsUserLocation = YES;
    self.mapView.userTrackingMode = MAUserTrackingModeFollow;
    self.mapView.userLocation.title = @"您的位置在这里";
    
    MAUserLocationRepresentation *represent = [[MAUserLocationRepresentation alloc] init];
    represent.showsAccuracyRing = NO;
    represent.showsHeadingIndicator = NO;
    represent.fillColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:.3];
    represent.strokeColor = [UIColor lightGrayColor];;
    represent.lineWidth = 2.f;
    represent.image = [UIImage imageNamed:@"我的定位"];
    [self.mapView updateUserLocationRepresentation:represent];
    
    
    
    UIView *topView=[[UIView alloc]init];
    [self.mapView addSubview:topView];
    [topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.top.mas_equalTo(10);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH-10, 40));
    }];
    topView.backgroundColor=[UIColor whiteColor];
    topView.layer.masksToBounds=YES;
    topView.layer.cornerRadius=20;
    

    UILabel *tipLab=[SingLeton myLabel:[UIColor colorWithHexString:@"222222"] andTitle:@"您还未交纳押金，无法享受优惠。" andFont:14];
    [topView addSubview:tipLab];
    [tipLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.centerY.mas_equalTo(topView);
        
    }];
    
    YKButton *toBuyButton=[SingLeton endButton:[UIColor colorWithHexString:@"09be00"] andTitle:@"交纳押金" RequestSuccess:^(UIButton *btn) {
        PaymentViewController *vc=[[PaymentViewController alloc]init];
        [self.navigationController pushViewController:vc animated:YES];
    }];
    [topView addSubview:toBuyButton];
    [toBuyButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(topView);
        make.size.mas_equalTo(CGSizeMake(80, 26));
    }];
    toBuyButton.titleLabel.font=[UIFont systemFontOfSize:14];
    toBuyButton.layer.cornerRadius=13;
    
    
    
    UIButton *scanButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [self.mapView addSubview:scanButton];
    [scanButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(-10);
        make.centerX.mas_equalTo(self.mapView);
        
    }];
    [scanButton setBackgroundImage:[UIImage imageNamed:@"扫码换电"] forState:UIControlStateNormal];
    [scanButton addTarget:self action:@selector(scanAction) forControlEvents:UIControlEventTouchUpInside];
    
    
    [self bottomViewLoad];
    
    
    
    
    
    
    
    
    
    
    
    UIButton *phonelocButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [self.mapView addSubview:phonelocButton];
    [phonelocButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(13);
        make.bottom.mas_equalTo(_bottomView.mas_top).mas_offset(-20);
        
    }];
    [phonelocButton setBackgroundImage:[UIImage imageNamed:@"我的位置"] forState:UIControlStateNormal];
    [phonelocButton addTarget:self action:@selector(showphoneloc) forControlEvents:UIControlEventTouchUpInside];
    
    
    
    UIButton *carlocButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [self.mapView addSubview:carlocButton];
    [carlocButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(13);
        make.bottom.mas_equalTo(phonelocButton.mas_top).mas_offset(-15);
        
    }];
    [carlocButton setBackgroundImage:[UIImage imageNamed:@"电动车位置"] forState:UIControlStateNormal];
    [carlocButton addTarget:self action:@selector(showCarloc) forControlEvents:UIControlEventTouchUpInside];
    
    
    
    
    
    
   
    
    
    
    UIButton *batterylocButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [self.mapView addSubview:batterylocButton];
    [batterylocButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-13);
        make.bottom.mas_equalTo(_bottomView.mas_top).mas_offset(-20);
    }];
    [batterylocButton setBackgroundImage:[UIImage imageNamed:@"电站位置"] forState:UIControlStateNormal];
    [batterylocButton addTarget:self action:@selector(showbatteryloc) forControlEvents:UIControlEventTouchUpInside];
    
    
}
-(void)bottomViewLoad
{
    UIView *bottomView=[[UIView alloc]init];
    [self.mapView addSubview:bottomView];
    [bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.mas_equalTo(self.mapView.mas_bottom);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, 150));
    }];
    bottomView.backgroundColor=[UIColor whiteColor];
    _bottomView=bottomView;
    
    
    UILabel *lineLab=[[UILabel alloc]init];
    [bottomView addSubview:lineLab];
    [lineLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(bottomView);
        make.top.mas_equalTo(30);
        make.size.mas_equalTo(CGSizeMake(1, 40));
    }];
    
    
    UILabel *powerLab=[SingLeton myLabel:[UIColor colorWithHexString:@"09be00"] andTitle:@"80" andFont:40];
    [bottomView addSubview:powerLab];
    [powerLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(25);
        make.centerX.mas_equalTo(bottomView.mas_left).mas_offset(SCREEN_WIDTH/4);
    }];
    
    UILabel *unitLab=[SingLeton myLabel:[UIColor colorWithHexString:@"09be00"] andTitle:@"%" andFont:17];
    [bottomView addSubview:unitLab];
    [unitLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(powerLab.mas_right).mas_offset(6);
        make.bottom.mas_equalTo(powerLab.mas_bottom);
    }];
    
    
    UILabel *powerTipLab=[SingLeton myLabel:[UIColor color6] andTitle:@"电池剩余电量" andFont:14];
    [bottomView addSubview:powerTipLab];
    [powerTipLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(bottomView.mas_left).mas_offset(SCREEN_WIDTH/4);
        make.top.mas_equalTo(powerLab.mas_bottom).mas_offset(8);
    }];
    
    
    UILabel *distanceLab=[SingLeton myLabel:[UIColor colorWithHexString:@"09be00"] andTitle:@"42" andFont:40];
    [bottomView addSubview:distanceLab];
    [distanceLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(25);
        make.centerX.mas_equalTo(bottomView.mas_left).mas_offset(SCREEN_WIDTH/4*3);
    }];
    
    UILabel *kmLab=[SingLeton myLabel:[UIColor colorWithHexString:@"09be00"] andTitle:@"km" andFont:17];
    [bottomView addSubview:kmLab];
    [kmLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(distanceLab.mas_right).mas_offset(6);
        make.bottom.mas_equalTo(distanceLab.mas_bottom);
    }];
    
    UILabel *distanceTipLab=[SingLeton myLabel:[UIColor color6] andTitle:@"预计骑行里程" andFont:14];
    [bottomView addSubview:distanceTipLab];
    [distanceTipLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(bottomView.mas_left).mas_offset(SCREEN_WIDTH/4*3);
        make.top.mas_equalTo(distanceLab.mas_bottom).mas_offset(8);
    }];
    
    UILabel *someLab=[SingLeton myLabel:[UIColor color9] andTitle:@"将电池归还后自动结束本次租赁。" andFont:14];
    [bottomView addSubview:someLab];
    [someLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(-20);
        make.centerX.mas_equalTo(bottomView);
    }];
    
    
}
-(void)showCarloc
{
    
    if (_coor.latitude==0 &&_coor.longitude==0) {
        
    }else
    {
     [self.mapView setCenterCoordinate:_coor];
    }

//    [_bottomView mas_remakeConstraints:^(MASConstraintMaker *make) {
//        make.left.mas_equalTo(0);
//        make.bottom.mas_equalTo(0);
//        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, 150));
//    }];
}
-(void)showphoneloc
{
    if (self.mapView.userLocation) {
      [self.mapView setCenterCoordinate:self.mapView.userLocation.coordinate];
    }
    
}
-(void)showbatteryloc
{
  [self.mapView showAnnotations:self.annotations animated:YES];
    [self.mapView showAnnotations:self.annotations edgePadding:UIEdgeInsetsMake(0, 0, 150, 0) animated:YES];
    
}
-(void)scanAction
{
//    [self noPackageAction];
    HCScanQRViewController *scan = [[HCScanQRViewController alloc] initWithSuccessBlock:^(NSString *QRCodeInfo) {
        NSLog(@"%@",QRCodeInfo);
        UnLockViewController *vc=[[UnLockViewController alloc]init];
        [self.navigationController pushViewController:vc animated:YES];
        
    }];
    [self.navigationController pushViewController:scan animated:YES];
}
-(void)noPackageAction
{
    if (self.noPackageView==nil) {
        self.noPackageView=[[UIView alloc]init];
        self.noPackageView.backgroundColor = [UIColor colorWithRed:0/255. green:0/255. blue:0/255. alpha:0.1];
        [self.view.window addSubview:self.noPackageView];
        [self.noPackageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.center.mas_equalTo(self.view.window);
            make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT));
        }];
        
        UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideCurrentVC:)];
        [self.noPackageView addGestureRecognizer:tap];
        
        
        UIView *middleView=[[UIView alloc]init];
        [self.noPackageView addSubview:middleView];
        [middleView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.center.mas_equalTo(self.noPackageView);
            make.size.mas_equalTo(CGSizeMake(310, 320));
        }];
        middleView.backgroundColor=[UIColor whiteColor];
        middleView.layer.masksToBounds=YES;
        middleView.layer.cornerRadius=6;
        
        //登录背景图
        UIImageView *bgimg=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"登录背景图"]];
        [middleView addSubview:bgimg];
        [bgimg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(middleView);
            make.top.mas_equalTo(24);
            
        }];
        
        
        
        UILabel *tipLab=[SingLeton myLabel:[UIColor colorWithHexString:@"222222"] andTitle:@"您未购买套餐，还不能扫码换电池。" andFont:14];
        [middleView addSubview:tipLab];
        [tipLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(middleView);
            make.top.mas_equalTo(bgimg.mas_bottom).mas_offset(10);
        }];
        
        
        YKButton *toBuyButton=[SingLeton endButton:[UIColor colorWithHexString:@"09be00"] andTitle:@"购买套餐" RequestSuccess:^(UIButton *btn) {
            [self.noPackageView removeFromSuperview];
            self.noPackageView=nil;
        }];
        [middleView addSubview:toBuyButton];
        [toBuyButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.mas_equalTo(-25);
            make.centerX.mas_equalTo(middleView);
            make.size.mas_equalTo(CGSizeMake(210, 44));
        }];
        
        
        
    }
}
-(void)hideCurrentVC:(UIGestureRecognizer *)tap{
    [self.noPackageView removeFromSuperview];
    self.noPackageView=nil;
}
-(void)leftAction
{
    
    LeftViewController *vc=[[LeftViewController alloc]init];
    // 调用这个方法
    [self cw_showDrawerViewController:vc animationType:CWDrawerAnimationTypeDefault configuration:nil];
}
-(void)rightAction
{
//    RightViewController *vc = [[RightViewController alloc] init];
//    
//    CWLateralSlideConfiguration *conf = [CWLateralSlideConfiguration configurationWithDistance:0 maskAlpha:0.4 scaleY:0.8 direction:CWDrawerTransitionDirectionRight backImage:[UIImage imageNamed:@"back.jpg"]];
//    
//    [self cw_showDrawerViewController:vc animationType:0 configuration:conf];
}
-(void)alertShow1
{
    UIAlertController *alertController=[UIAlertController alertControllerWithTitle:@"续套餐提醒" message:@"您的电池套餐今日到期，请在明日12:00之前到电站归还或购买套餐。" preferredStyle:UIAlertControllerStyleAlert];
            UIAlertAction *noAction=[UIAlertAction actionWithTitle:@"知道了" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
    
            }];
    
            UIAlertAction *someAction=[UIAlertAction actionWithTitle:@"立即购买" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
    
            }];
    
    
            [alertController addAction:noAction];
            [alertController addAction:someAction];
            [self presentViewController:alertController animated:YES completion:nil];
            [noAction setValue:[UIColor color9] forKey:@"titleTextColor"];
            [someAction setValue:[UIColor colorWithHexString:@"09be00"] forKey:@"titleTextColor"];
}
-(void)alertShow2
{
    
    UIAlertController *alertController=[UIAlertController alertControllerWithTitle:@"续套餐提醒" message:@"您的电池套餐已经到期，请在12:00之前到电站归还或购买套餐，12:00后电池将会自动断电。" preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *noAction=[UIAlertAction actionWithTitle:@"知道了" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    
    UIAlertAction *someAction=[UIAlertAction actionWithTitle:@"立即购买" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    
    
    [alertController addAction:noAction];
    [alertController addAction:someAction];
    [self presentViewController:alertController animated:YES completion:nil];
    [noAction setValue:[UIColor color9] forKey:@"titleTextColor"];
    [someAction setValue:[UIColor colorWithHexString:@"09be00"] forKey:@"titleTextColor"];
}
-(void)alertShow3
{
    UIAlertController *alertController=[UIAlertController alertControllerWithTitle:@"续套餐提醒" message:@"由于电池套餐到期，您租赁的电池已断电，请购买套餐。" preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *noAction=[UIAlertAction actionWithTitle:@"知道了" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    
    UIAlertAction *someAction=[UIAlertAction actionWithTitle:@"立即购买" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    
    
    [alertController addAction:noAction];
    [alertController addAction:someAction];
    [self presentViewController:alertController animated:YES completion:nil];
    [noAction setValue:[UIColor color9] forKey:@"titleTextColor"];
    [someAction setValue:[UIColor colorWithHexString:@"09be00"] forKey:@"titleTextColor"];
}
#pragma mark - mapview delegate
- (void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation updatingLocation:(BOOL)updatingLocation
{
    if (!updatingLocation)
    {
//        MAAnnotationView *userLocationView = [mapView viewForAnnotation:mapView.userLocation];
//        [UIView animateWithDuration:0.1 animations:^{
//
//            double degree = userLocation.heading.trueHeading - self.mapView.rotationDegree;
//            userLocationView.imageView.transform = CGAffineTransformMakeRotation(degree * M_PI / 180.f );
//        }];
    }
}
/*!
 @brief 根据anntation生成对应的View
 @param mapView 地图View
 @param annotation 指定的标注
 @return 生成的标注View
 */
- (MAAnnotationView*)mapView:(MAMapView *)mapView viewForAnnotation:(id <MAAnnotation>)annotation {
    if ([annotation isKindOfClass:[MAPointAnnotation class]])
    {
        if ([annotation.title isEqualToString:@"电站定位"])
        {
            static NSString *pointReuseIndetifier = @"pointReuseIndetifier";
            MAPinAnnotationView *annotationView = (MAPinAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:pointReuseIndetifier];
            if (annotationView == nil)
            {
                annotationView = [[MAPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:pointReuseIndetifier];
            }
            
            annotationView.canShowCallout               = NO;
            annotationView.animatesDrop                 = NO;
            annotationView.draggable                    = YES;
            annotationView.rightCalloutAccessoryView    = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
            //        annotationView.pinColor                     = [self.annotations indexOfObject:annotation] % 3;
            annotationView.image=[UIImage imageNamed:@"电站定位"];
            
            return annotationView;
        }else if ([annotation.title isEqualToString:@"电动车定位"])
        {
            static NSString *pointReuseIndetifier = @"pointReuseIndetifier";
            MAPinAnnotationView *annotationView = (MAPinAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:pointReuseIndetifier];
            if (annotationView == nil)
            {
                annotationView = [[MAPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:pointReuseIndetifier];
            }
            
            annotationView.canShowCallout               = NO;
            annotationView.animatesDrop                 = NO;
            annotationView.draggable                    = YES;
            annotationView.rightCalloutAccessoryView    = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
            //        annotationView.pinColor                     = [self.annotations indexOfObject:annotation] % 3;
            annotationView.image=[UIImage imageNamed:@"电动车定位"];
            
            return annotationView;
        }
        
    }
    
    return nil;
}

/*!
 @brief 当mapView新添加annotation views时调用此接口
 @param mapView 地图View
 @param views 新添加的annotation views
 */
- (void)mapView:(MAMapView *)mapView didAddAnnotationViews:(NSArray *)views {
    
}

/*!
 @brief 当选中一个annotation views时调用此接口
 @param mapView 地图View
 @param views 选中的annotation views
 */
- (void)mapView:(MAMapView *)mapView didSelectAnnotationView:(MAAnnotationView *)view {
    
}

/*!
 @brief 当取消选中一个annotation views时调用此接口
 @param mapView 地图View
 @param views 取消选中的annotation views
 */
- (void)mapView:(MAMapView *)mapView didDeselectAnnotationView:(MAAnnotationView *)view {
    
}

/*!
 @brief 标注view的accessory view(必须继承自UIControl)被点击时调用此接口
 @param mapView 地图View
 @param annotationView callout所属的标注view
 @param control 对应的control
 */
- (void)mapView:(MAMapView *)mapView annotationView:(MAAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control {
    
}

/**
 *  标注view的calloutview整体点击时调用此接口
 *
 *  @param mapView 地图的view
 *  @param view calloutView所属的annotationView
 */
- (void)mapView:(MAMapView *)mapView didAnnotationViewCalloutTapped:(MAAnnotationView *)view {
    
}

/*!
 @brief 拖动annotation view时view的状态变化，ios3.2以后支持
 @param mapView 地图View
 @param view annotation view
 @param newState 新状态
 @param oldState 旧状态
 */
- (void)mapView:(MAMapView *)mapView annotationView:(MAAnnotationView *)view didChangeDragState:(MAAnnotationViewDragState)newState fromOldState:(MAAnnotationViewDragState)oldState {
    
}

@end
